import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import Home from '@/components/Home'
import Welcome from '@/components/Welcome'
import Users from '@/components/user/Users'

Vue.use(Router)

const router = new Router({
  mode: 'history',
  base:'/preview/',
  routes: [

  ]
})

router.beforeEach((to, from, next) => {
  /*if(to.path === '/login'){
    return next()
  }
  const token = window.sessionStorage.getItem('token')
  if (!token) {
    return next('/login')
  }else{
    if (to.path === '/login') {
      return next('/home')
    }else{
      next()
    }
  }*/
})

export default router
